/*
 * utils.h
 *
 *  Created on: 28.10.2010
 *      Author: jilly
 */

#ifndef UTILS_H_
#define UTILS_H_

#include <limits>
#include <fstream>
#include <cmath>
#include <iostream>

using namespace std;

int digits(unsigned int number)
{
  if (number != 0) {
    double lg = std::log10(number);
    double eps = std::numeric_limits<double>::epsilon();
    return static_cast<int>(1 + lg + eps);
  }
  else
    return 1;
}

void printSpaces(unsigned int howMany)
{
	for (unsigned int i=0; i < howMany; i++) cout << " ";
}

void writeSpaces(unsigned int howMany, ofstream& stream)
{
	for (unsigned int i=0; i < howMany; i++) stream << " ";
}

#endif /* UTILS_H_ */
